-- 全服双倍经验活动

function doubleExpActivityHandle(sysarg, args)
	local dVar = Actor.getDyanmicVar(sysarg);
	if not dVar then dVar = {} end

	local cfg = StdActivityCfg[3];
	local tOpenTime = cfg.tOpenTime.times;
	local bStart, nIdx = checkTimer(tOpenTime);
	if nIdx <= -1 then
		dVar.sbexp = nil;
		local expbuff = cfg.expbuff;
		Actor.delBuff(sysarg, expbuff.type, expbuff.groupid);
		return;
	end
	
	if not dVar.sbexp then
		-- 暂时记录活动id
		dVar.sbexp = 3;
		local endHour = tonumber(tOpenTime[nIdx][3]);
		local endMin = tonumber(tOpenTime[nIdx][4]);
		local uSecond = System.ResidualTime(endHour, endMin, 0);
		
		local expbuff = cfg.expbuff;
		if expbuff.timeOverlay == false then
			Actor.delBuff(sysarg, expbuff.type, expbuff.groupid);
		end
			
		Actor.addBuff(sysarg, expbuff.type, expbuff.groupid, expbuff.multiple, expbuff.times, uSecond, expbuff.desc, expbuff.timeOverlay, nil, 0, 0, 0, expbuff.icon);
	end
end

EventCallDispatcher.registerEventCall(BaseTypes.ActorEventId.aeDoubleExpActivity, doubleExpActivityHandle)